package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.sc.nft.entity.DaoSchoolMaterial;
import com.sc.nft.entity.dto.DaoSchoolMaterialPageAdminDTO;
import com.sc.nft.entity.vo.DaoSchoolMaterialArticlePageAdminVO;
import com.sc.nft.mapper.DaoSchoolMaterialMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

/**
 * 素材表(DaoSchoolMaterial)表Dao层
 *
 * @author makejava
 * @since 2023-03-13 16:22:04
 */
@Slf4j
@Repository
public class DaoSchoolMaterialDao extends ServiceImpl<DaoSchoolMaterialMapper, DaoSchoolMaterial> {

    /**
     * 后台获取分页列表
     *
     * @param pageRequest
     * @return
     */
    public Page<DaoSchoolMaterialArticlePageAdminVO> pageAdmin(DaoSchoolMaterialPageAdminDTO daoSchoolMaterialPageAdminDTO) {
        return baseMapper.pageAdmin(daoSchoolMaterialPageAdminDTO.toMp(), daoSchoolMaterialPageAdminDTO);
    }

    /**
     * 删除文章
     *
     * @param id
     * @return
     */
    public Boolean deleteById(Long id) {
        return SqlHelper.retBool(baseMapper.deleteById(id));
    }

}
